/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import dao.OrderDAO;
import dto.Order;
import dto.Product;
import java.sql.SQLException;
import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import util.ConnectDB;

/**
 *
 * @author SonLK60201
 */
public class OrderController extends BaseController {

    private Product product;
    private OrderDAO orderDAO;
    private Collection<Order> orders;
    private Log log = LogFactory.getLog(OrderController.class);

    public OrderController() {
//        super();
        _database = new ConnectDB();
        orderDAO = new OrderDAO(_database);
    }

    public String load_orders() {
        try {
            orders = orderDAO.getAll();
            return SUCCESS;
        } catch (SQLException ex) {
            log.error("OrderController.load_orders()", ex);
        }


        return ERROR;
    }

    public String product_order() {

        return SUCCESS;
    }

    public String submit_checkout() {
        // TODO code
        return SUCCESS;
    }

    /**
     * @return the product
     */
    public Product getProduct() {
        return product;
    }

    /**
     * @param product the product to set
     */
    public void setProduct(Product product) {
        this.product = product;
    }

    /**
     * @return the orders
     */
    public Collection<Order> getOrders() {
        return orders;
    }

    /**
     * @param orders the orders to set
     */
    public void setOrders(Collection<Order> orders) {
        this.orders = orders;
    }
}
